load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_path")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
load("@com_github_grpc_ecosystem_grpc_gateway//protoc-gen-swagger:defs.bzl", "protoc_gen_swagger")

proto_library(
    name = "go_client_proto",
    srcs = [
        "auth.proto",
        "error.proto",
        "experiment.proto",
        "filter.proto",
        "job.proto",
        "parameter.proto",
        "pipeline.proto",
        "pipeline_spec.proto",
        "report.proto",
        "resource_reference.proto",
        "run.proto",
        "visualization.proto",
    ],
    visibility = ["//visibility:public"],
    deps = [
        "@com_github_grpc_ecosystem_grpc_gateway//protoc-gen-swagger/options:options_proto",
        "@com_google_protobuf//:any_proto",
        "@com_google_protobuf//:empty_proto",
        "@com_google_protobuf//:timestamp_proto",
        "@go_googleapis//google/api:annotations_proto",
    ],
)

go_proto_library(
    name = "go_client_go_proto",
    compilers = [
        "@io_bazel_rules_go//proto:go_grpc",
        "@com_github_grpc_ecosystem_grpc_gateway//protoc-gen-grpc-gateway:go_gen_grpc_gateway",
    ],
    importpath = "github.com/kubeflow/pipelines/backend/api/go_client",  # keep
    proto = ":go_client_proto",
    visibility = ["//visibility:public"],
    deps = [
        "@com_github_grpc_ecosystem_grpc_gateway//protoc-gen-swagger/options:go_default_library",
        "@go_googleapis//google/api:annotations_go_proto",
    ],
)

go_library(
    name = "go_default_library",
    embed = [":go_client_go_proto"],
    importpath = "github.com/kubeflow/pipelines/backend/api/go_client",
    visibility = ["//visibility:public"],
)

protoc_gen_swagger(
    name = "api_swagger",
    proto = ":go_client_proto",
)

go_path(
    name = "api_generated_go_sources",
    deps = [
        ":go_client_go_proto",
    ],
)
